package com.guomei.mapper.curse;

import com.guomei.bean.curse.CourseClassAssociation;
import com.guomei.bean.curse.vo.CourseClassAssociationVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 课程班关联课程Mapper接口
 */
public interface CourseClassAssociationMapper {
    
    /**
     * 根据ID查询
     */
    CourseClassAssociation selectById(@Param("id") Long id);
    
    /**
     * 查询所有
     */
    List<CourseClassAssociation> selectAll();
    
    /**
     * 条件查询
     */
    List<CourseClassAssociation> selectByCondition(CourseClassAssociation courseClassAssociation);
    
    /**
     * 新增
     */
    int insert(CourseClassAssociation courseClassAssociation);
    
    /**
     * 批量新增
     */
    int batchInsert(List<CourseClassAssociation> courseClassAssociations);
    
    /**
     * 根据ID更新
     */
    int updateById(CourseClassAssociation courseClassAssociation);
    
    /**
     * 根据ID删除
     */
    int deleteById(@Param("id") Long id);
    
    /**
     * 批量删除
     */
    int batchDelete(@Param("ids") List<Long> ids);
    
    /**
     * 根据主课程ID查询
     */
    List<CourseClassAssociation> selectByMainCourseId(@Param("mainCourseId") Long mainCourseId);
    
    /**
     * 根据下属课程ID查询
     */
    List<CourseClassAssociation> selectByDeputyCourseId(@Param("deputyCourseId") Long deputyCourseId);
    
    /**
     * 根据主课程ID删除
     */
    int deleteByMainCourseId(@Param("mainCourseId") Long mainCourseId);
    
    /**
     * 根据下属课程ID删除
     */
    int deleteByDeputyCourseId(@Param("deputyCourseId") Long deputyCourseId);
    
    /**
     * 检查关联是否存在
     */
    CourseClassAssociation selectByMainAndDeputyCourseId(@Param("mainCourseId") Long mainCourseId, @Param("deputyCourseId") Long deputyCourseId);
    
    /**
     * 根据条件查询课程班关联课程（联表查询，返回VO对象）
     */
    List<CourseClassAssociationVo> selectByConditionWithCourses(CourseClassAssociation courseClassAssociation);
}
